package com.ruoyi.tester.executor.expression;

import com.ruoyi.tester.executor.ExpressionContext;
import org.springframework.stereotype.Component;

import java.util.Calendar;

/**
 * @author SongJun
 * @description TODO:
 * @date 2021/6/17 18:23
 */
@Component
public class ExpCurrentMillisecond extends AbstractExpTime{

    @Override
    public String getExpressionName() {
        return "currentMillisecond";
    }

    @Override
    public String getDescription() {
        return "currentMillisecond() 返回当前毫秒级时间戳, 如: 1650532194251;"+super.getDescription();
    }

    @Override
    public Object analysis(ExpressionContext context, String... param) {
        Calendar calendar = (Calendar)super.analysis(context, param);
        return calendar.getTimeInMillis();
    }
}
